<!--
 * @Description: 
 * @Author: lwx
 * @Date: 2023-03-10 08:23:19
 * @LastEditors: lwx
 * @LastEditTime: 2023-04-07 09:12:50
-->
<template>
   <div class="searchArea">
      <el-form size="mini" :inline="true">
        <el-form-item label="设备">    
          <el-select v-model="machine_no" clearable @clear="resetData" placeholder="请选择">
            <el-option
              v-for="item in deviceList"
              :key="item.machine_no"
              :label="item.name"
              :value="item.machine_no">
            </el-option>
          </el-select>   
        </el-form-item>
        <el-form-item>
          <el-button 
            type="primary" 
            size="mini" 
            icon="el-icon-search"
            @click="getRecordData()"
            >查询
          </el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
import {DeviceList} from '@/api/device.js'
export default {
  data () {
    return {
        machine_no:null,
        deviceList:[]
    }
  },
  created() {
    this.getDeviceData()//获取设备列表
  },
  methods:{
     //设备列表
   async getDeviceData(){
     const {data}= await DeviceList()
     this.deviceList=data
   },
   getRecordData(){
    this.$emit('getRecordData',this.machine_no)
   },
   resetData(){
    this.$emit('resetData')
   }
  }
}
</script>
<style lang='scss' scoped>
</style>